package com.xiaoxi.strategymode;

import com.xiaoxi.strategymode.play.Hand;
import com.xiaoxi.strategymode.play.Player;
import com.xiaoxi.strategymode.strategy.PollingStrategy;
import com.xiaoxi.strategymode.strategy.ProbStrategy;
import com.xiaoxi.strategymode.strategy.WinningStrategy;

/**
 * @Author xiaoxi
 * @ProjectName design_mode
 * @PackageName com.xiaoxi.strategymode
 * @ClassName Main
 * @Description TODO
 * @Date 2023/3/13 20:39
 * @Version 1.0
 */
public class Main {
    public static void main(String[] args) {

        Player player1 = new Player("小秦", new WinningStrategy());
        Player player2 = new Player("小红", new ProbStrategy());

        for (int i = 0; i < 1000; i++) {
            Hand hand1 = player1.nextHand();
            Hand hand2 = player2.nextHand();
            if (hand1.isStronger(hand2)) {
                player1.win();
                player2.lose();
            } else if (hand2.isStronger(hand1)) {
                player1.lose();
                player2.win();
            } else {
                player1.even();
                player2.even();
            }
        }

        System.out.println(player1);
        System.out.println(player2);

    }
}
